<template>
  <div>
    <button @click="changeType" v-if="isShow">点击开始集结部队</button>
    <input type="text" v-model="content" v-else  @change="CompletedCa" ref="f2a">
  </div>
</template>

<script>
// dom.focus() 获取焦点
export default {
  data() {
    return {
      content:'',
      isShow:true
    }
  },
  methods: {
    changeType(){
      this.isShow=!this.isShow
      this.$nextTick(()=>{
        this.$refs.f2a.focus()
      })
    },
    CompletedCa(){
      console.log(this.content);
      this.isShow=!this.isShow
      this.content=''
    }
  }
}
</script>

<style>
</style>